<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>${appname}</title>
<%@ include file="/WEB-INF/jsp/common/css_js_base.jsp"%>
<link rel="stylesheet" href="/static/plugins/iCheck/square/blue.css">
<script src="/static/plugins/js.cookie/js.cookie.js"></script>
</head>

<body class="hold-transition register-page" style="background-image: url('/static/img/login_bg.jpg')">
	<div class="register-box">
		<div class="register-logo">
			<a href="/"><b style="color: #fff">schedule-console</b></a>
		</div>
		<div class="register-box-body">
			<p class="login-box-msg">用户登录</p>
			<c:choose>
				<c:when test="${user != null}">
					<div class="form-group has-feedback" style="text-align: center;">
						<span style="font-size: 30px;">${user.userName}</span>
					</div>
					<div class="row">
						<div class="col-xs-12">
							<button type="button" class="btn btn-primary btn-block btn-flat" id="sbmBtn">登录</button>
						</div>
					</div>
					<script type="text/javascript">
						$(function(){
							$('#sbmBtn').on('click',function(){
								window.location.href = '/home';
							});
							$(document).keypress(function(e) {
								if(e.which == 13) {
									$('#sbmBtn').click();
								}
							});
						});
					</script>
				</c:when>
				<c:otherwise>
					<form action="/login" method="post" id="inputForm" name="inputForm">
						<div class="form-group has-feedback" id="userNameDiv">
							<input type="text" name="userName" id="userName" class="form-control" placeholder="用户名" />
								<span class="fa fa-mobile form-control-feedback"></span>
								<span id="userNameMsg"></span>
						</div>
						<div class="form-group has-feedback" id="passwordDiv">
							<input type="password" name="password" id="password" class="form-control" placeholder="密码" />
								<span class="fa fa-key form-control-feedback"></span>
								<span id="passwordMsg"></span>
						</div>
						<div class="row">
							<div class="col-xs-12">
								<button type="button" class="btn btn-primary btn-block btn-flat" id="sbmBtn">登录</button>
							</div>
						</div>
					</form>
					<script type="text/javascript" src="/static/js/schedule/login.js" ></script>
				</c:otherwise>
			</c:choose>
		</div>
	</div>
</body>
</html>